package org.choviwu.top.qg.util;

/**
 * @author : junshang
 * @createTime : 2014-10-29 下午11:48:08
 * @version : 1.0
 * @description :
 *
 */
public class SQIDUtils {

	/**
	 * 简单加密id
	 * @return
	 */
	public static String encodeId(Integer id) {
		return StringUtils.base32Encrypt(simPileEncodeId(id));
	}

	/**
	 * 简单加密id
	 * @return
	 */
	private static Integer simPileEncodeId(Integer id) {
		return id * 30 + 20;
	}

	/**
	 * 解密简单id
	 * @return
	 */
	public static int decodeId(String id) {
		return (int) (StringUtils.base32Decrypt(id) - 20) / 30;
	}

}
